<template>
  <div>
    <div class="video-content">
      <div class="video-dialog">
        <video id="train-video" :src="url" controls="controls" controlslist="nodownload"/>
      </div>
    </div>
  </div>
</template>

<script>
// import $ from 'jquery'

export default {
  props:{
    url:{
      type:String,
      default:""
    }
  },
  data () {
    return {
      showPlayMp4: false,
    }
  },
  created () {
    this.$bus.$on('playMP4', (params) => {
      this.showPlayMp4 = true
      const video = document.getElementById('train-video')
      video.src = params.url
      this.$nextTick(() => {
        video.play()
      })
    })
    this.$bus.$on('pauseMP4', () => {
      const video = document.getElementById('train-video')
      video.pause()
      video.currenttime = 0
      this.showPlayMp4 = false
    })
  },
}
</script>

